package org.example.mall.Mapper;

import com.mysql.cj.util.DnsSrv;
import org.apache.ibatis.annotations.*;
import org.example.mall.Pojo.ConsigneeInfo;
import org.springframework.stereotype.Repository;

import java.util.List;
@Mapper
@Repository
public interface ConsigneeInfoMapper {
    //查找
    @Select("select * from ConsigneeInfo where cId = #{arg0}")
    ConsigneeInfo getConsigneeInfoByCId(Integer cId);
    @Select("select * from ConsigneeInfo where userName=#{arg0}")
    List<ConsigneeInfo> getConsigneeInfoListByUserName(String userName);
    //创建与删除
    @Insert("insert into ConsigneeInfo(userName, consigneeName, consigneePhone, consigneeAddress, areaCode) values (#{arg0},#{arg1},#{arg2},#{arg3},#{arg4})")
    void createConsigneeInfo(String userName, String cName, String cPhone, String cAddress, String areaCode);
    @Delete("delete from ConsigneeInfo where cId = #{arg0}")
    void deleteConsigneeInfo(Integer cId);
    //更新
    @Update("update ConsigneeInfo set consigneeName = #{arg1} where cId = #{arg0}")
    void updateConsigneeName(Integer cId, String cName);

    @Update("update ConsigneeInfo set userName = 'nullUser' where cId = #{arg0}")
    void UpdateUserNameToNull(Integer cId);

    @Update("update ConsigneeInfo set consigneePhone = #{arg1} where cId = #{arg0}")
    void updateConsigneePhone(Integer cId, String cPhone);
    @Update("update ConsigneeInfo set consigneeAddress = #{arg1} where cId = #{arg0}")
    void updateConsigneeAddress(Integer cId, String cAddress);

}
